﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:sys="clr-namespace:System;assembly=mscorlib"
        xmlns:odc="clr-namespace:Odyssey.Controls">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/Odyssey;Component/Themes/Ribbon/DefaultRibbonButtonBrushes.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <odc:RoundedCornerResizeConverter x:Key="roundedCornerConverter" />
    <sys:Double x:Key="{ComponentResourceKey odc:Skins, DisabledImageOpacity}">0.50</sys:Double>

    <BooleanToVisibilityConverter x:Key="boolToVisible" />
    
  
    <Style TargetType="{x:Type odc:RibbonChrome}">
        <!--<Setter Property="MouseOverBackground" Value="{DynamicResource {ComponentResourceKey odc:Skins, DefaultMouseOverBtnBrush}}" />
        <Setter Property="MousePressedBackground" Value="{DynamicResource {ComponentResourceKey odc:Skins, DefaultMousePressedBtnBrush}}" />
        <Setter Property="BorderBrush" Value="{DynamicResource {ComponentResourceKey odc:Skins, DefaultBorderBrush}}" />-->
        <!--<Setter Property="Background" Value="{DynamicResource {ComponentResourceKey odc:Skins, DefaultBgBrush}}" />-->

        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="InnerBorderThickness" Value="1" />
        <Setter Property="Padding" Value="2" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="RenderFlat" Value="true" />
        <Setter Property="Focusable" Value="False" />

        <Setter Property="Background" Value="{DynamicResource {ComponentResourceKey odc:Skins, HighlightedPressedBtnBrush}}" />
        <Setter Property="MouseOverBackground" Value="{DynamicResource {ComponentResourceKey odc:Skins, HighlightedMouseOverBtnBrush}}" />
        <Setter Property="MousePressedBackground" Value="{DynamicResource {ComponentResourceKey odc:Skins, HighlightedPressedBtnBrush}}" />
        <Setter Property="BorderBrush" Value="{DynamicResource {ComponentResourceKey odc:Skins, HighlightedRibbonBorderBrush}}" />
        <Setter Property="MouseOverBorderBrush" Value="{DynamicResource {ComponentResourceKey odc:Skins, MouseOverRibbonBorderBrush}}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type odc:RibbonChrome}">
                    <Grid x:Name="grid" Focusable="False">
                        <Border x:Name="defaultBtn" CornerRadius="{TemplateBinding CornerRadius}" Focusable="False" Visibility="Collapsed"
                                Margin="0" Opacity="1" HorizontalAlignment="Stretch" Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                            <Border x:Name="InnerBorder" Focusable="False" BorderThickness="{TemplateBinding InnerBorderThickness}"
                                    HorizontalAlignment="Stretch" BorderBrush="#80FFFFFF"
                                    CornerRadius="{Binding CornerRadius,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource roundedCornerConverter},ConverterParameter=-1}" />
                        </Border>
                        <Border x:Name="mouseOverBtn" CornerRadius="{TemplateBinding CornerRadius}" Focusable="False"
                                HorizontalAlignment="Stretch" Opacity="0" Margin="0" Background="{TemplateBinding MouseOverBackground}"
                                BorderBrush="{TemplateBinding MouseOverBorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                            <Border x:Name="mouseOverInnerBorder" Focusable="False" HorizontalAlignment="Stretch"
                                    BorderThickness="{TemplateBinding InnerBorderThickness}" BorderBrush="#C0FFFFFF"
                                    CornerRadius="{Binding CornerRadius,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource roundedCornerConverter},ConverterParameter=-1}" />
                        </Border>
                        <Border x:Name="mouseDownBtn" CornerRadius="{TemplateBinding CornerRadius}" Focusable="False"
                                HorizontalAlignment="Stretch" Visibility="Hidden" Background="{TemplateBinding MousePressedBackground}"
                                BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                            <Border Margin="0" x:Name="innerBorder2" Focusable="False" HorizontalAlignment="Stretch"
                                    BorderThickness="0.2,1.6,0.2,0" ClipToBounds="True"
                                    CornerRadius="{Binding CornerRadius,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource roundedCornerConverter},ConverterParameter=-1}"
                                    BorderBrush="{DynamicResource {ComponentResourceKey odc:Skins, BorderShadowBrush}}" />
                        </Border>
                        <ContentControl Content="{TemplateBinding Content}" Focusable="False" x:Name="content"
                                Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                ContentTemplate="{TemplateBinding ContentTemplate}" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="ShowInnerMouseOverBorder" Value="False">
                            <Setter Property="Visibility" Value="Collapsed" TargetName="mouseOverInnerBorder" />
                        </Trigger>
                        <Trigger Property="RenderFlat" Value="False">
                            <Setter Property="Visibility" Value="Visible" TargetName="defaultBtn" />
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="RenderMouseOver" Value="True" />
                                <Condition Property="odc:RibbonChrome.AnimateTransition" Value="False" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="defaultBtn" Property="BorderBrush" Value="Transparent" />
                            <Setter Property="Opacity" Value="1" TargetName="mouseOverBtn" />
                        </MultiTrigger>

                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="RenderMouseOver" Value="True" />
                                <Condition Property="odc:RibbonChrome.AnimateTransition" Value="True" />
                            </MultiTrigger.Conditions>
                            <MultiTrigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="mouseOverBtn" Storyboard.TargetProperty="Opacity"
                                                Duration="0:0:0.25" To="1" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </MultiTrigger.EnterActions>
                            <MultiTrigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="mouseOverBtn" Storyboard.TargetProperty="Opacity"
                                                Duration="0:0:0.25" To="0" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </MultiTrigger.ExitActions>
                        </MultiTrigger>

                        <Trigger Property="RenderPressed" Value="True">
                            <Setter Property="Visibility" TargetName="mouseDownBtn" Value="Visible" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Visibility" Value="Hidden" TargetName="mouseDownBtn" />
                            <Setter Property="Visibility" Value="Hidden" TargetName="mouseOverBtn" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>